package com.android.delivery.adapter

import android.app.Activity
import android.widget.TextView
import com.android.delivery.R
import com.android.delivery.activity.wangdian.DaiJieCheDetailsActivity
import com.android.delivery.activity.wangdian.DaiJieCheListFragment
import com.android.delivery.entity.Arrived
import com.android.delivery.util.CopyUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder

/**
 * @author: mqwang
 * @create: 3/20/21 7:13 AM
 * @Description:
 */
class DaiJieCheAdapter : BaseQuickAdapter<Arrived, BaseViewHolder>(R.layout.adapter_daijie_che) {
    override fun convert(helper: BaseViewHolder, item: Arrived?) {
        helper?.setText(R.id.tv_name, item?.realName)
        helper?.setText(R.id.tv_phone, item?.mobile)
        helper?.setText(R.id.tv_num, item?.quantity.toString()+"件")

        helper?.getView<TextView>(R.id.tv_details)?.setOnClickListener {
            DaiJieCheDetailsActivity.self(mContext as Activity, item!!, DaiJieCheListFragment.DETAIL_REQUEST_CODE)
        }

        helper.getView<TextView>(R.id.tv_phone).setOnClickListener{
            CopyUtil.callPhone(mContext, item?.mobile)
        }

    }
}